home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
COMPNENT
/
SAWIN95
/
HKTEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-10-28
|
2KB
|
80 lines
unit hktest;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
SysHot, StdCtrls, Menus, WComp;
type
TForm1 = class(TForm)
SysHotKey1: TSysHotKey;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
CheckBox1: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure SysHotKey1HotKey(Sender: TObject; Index: Integer);
procedure CheckBox1Click(Sender: TObject);
private
FActive : Boolean;
FShowing: Boolean;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
SysHotKey1.AddHotKey(vkSpace, [hkAlt]);
SysHotKey1.AddHotKey(vkF4, [hkAlt]);
SysHotKey1.AddHotKey(vkSnapshot, []);
SysHotKey1.AddHotKey(vkSpace, []);
SysHotKey1.AddHotKey(vkReturn, []);
FActive := False;
FShowing := False;
end;
procedure TForm1.SysHotKey1HotKey(Sender: TObject; Index: Integer);
begin
if not FActive and not FShowing then SetForeGroundWindow(Handle);
case Index of
0, 1 : begin
FActive := True;
ShowMessage('Sorry, this key has been overruled!!!!');
FActive := False;
end;
2 : begin
FActive := True;
ShowMessage('Didn''t you mother teach you that it isn''t nice to steal other people''s graphics?');
FActive := False;
end;
3, 4 : if not FShowing then
begin
FShowing := True;
ShowMessage('You''ll have to use the mouse instead of the keyboard to do this....!!'+#13+#10+'(The ENTER and SPACE keys are trapped as well....)');
FShowing := False;
end;
end;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
SysHotKey1.Active := TCheckBox(Sender).Checked;
FActive := True;
if SysHotKey1.Active then
ShowMessage('The hotkeys are now active')
else
ShowMessage('The hotkeys have been deactivated.');
FActive := False;
end;
end.